MAKE            =	make
CC              =	g++
LINK            =	-g -pedantic -Wall -lstdc++ -lpthread -ldl -lm -Wl,-rpath,.
COMPILE	        =	-g -O0 -D_THREAD_SAFE -pedantic -Wall -c -fPIC -Wno-deprecated 
INCPATH         =   ../include
LIB_DIR         =   ../lib/linux/
BIN_DIR         =   ../bin/linux/
EXE             =   cppTutor
LIB_VERSION     =   .1.0.0
STATIC          =   libcppTutorLog.a
SHARED          =   libcppTutorLog.so
SRCS            =   $(shell ls *.cpp)
OBJS            =   $(subst .cpp,.o,$(SRCS))

.SUFFIXES: .o .cpp .c

.cpp.o:
	$(CC) -I $(INCPATH) $(COMPILE) $<

all: $(OBJS)
	$(CC) -o $(BIN_DIR)$(EXE) $(OBJS) -L. $(LINK)

-include depend.mak

depend:
	g++ -MM $(SRCS) > depend.mak

shared: $(OBJS)
	$(CC) -shared -Wl,-soname -lc -o $(LIB_DIR)$(SHARED)$(LIB_VERSION) $(OBJS) -L.

static: $(OBJS)
	ar rucvs $(LIB_DIR)$(STATIC) $(OBJS)

clean:
	rm -rf $(OBJS) depend.mak

cleanapp:
	rm -rf $(BIN_DIR)$(EXE) $(LIB_DIR)*